package com.infisense.opencv.ui.home;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;

import com.infisense.opencv.R;
import com.infisense.opencv.databinding.FragmentHomeBinding;
import com.infisense.opencv.ui.home.bitmapdeal.BitmapDealActivity;

public class HomeFragment extends Fragment implements View.OnClickListener {

    //===
    private HomeViewModel homeViewModel;
    private FragmentHomeBinding binding;

    public View onCreateView(@NonNull LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        //===
        homeViewModel =
                new ViewModelProvider(this, new ViewModelProvider.NewInstanceFactory()).get(HomeViewModel.class);
        //===
        binding = FragmentHomeBinding.inflate(inflater, container, false);
        View root = binding.getRoot();
        //===
        binding.btnBitmapTogray.setOnClickListener(this);

        //===
        return root;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        binding = null;
    }


    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.btn_bitmap_togray) {
            startActivity(new Intent(getActivity(), BitmapDealActivity.class));
        }
    }
}